<!doctype html>
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta name="layout" content="common">
<title>Manage Deals</title>
</head>
<body id="body">
	<h2>Manage Redemption - Update</h2>
	<hr />
	<g:if test="${flash.message}">
		<div class="alert alert-success">
			<img src="${resource(dir:'images', file:'icon_successful.png') }" />&nbsp;&nbsp;${flash.message}
		</div>
	</g:if>
	<g:hasErrors bean="${dealInstance}">
			<ul class="errors" role="alert">
				<g:eachError bean="${dealInstance}" var="error">
				<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>> * <g:message error="${error}"/></li>
				</g:eachError>
			</ul>
	</g:hasErrors>
	<div class="row>">
		<g:form name="createDeal" method="POST" action="update">
			<g:hiddenField name="id" value="${dealInstance?.id}" />
			<g:hiddenField name="version" value="${dealInstance?.version}" />
			<table width="100%">
				<tr>
					<td width="30%">Title</td>
					<td>
						<g:textField name="title" value="${dealInstance.title}"/>
					</td>
				</tr>
				<tr>
					<td>ImageUrl</td>
					<td>
						<g:textField name="imageUrl" value="${dealInstance.imageUrl}"/>
					</td>
				</tr>
				<tr>
					<td>Description</td>
					<td>
						<g:textField name="description" value="${dealInstance.description}"/>
					</td>
				</tr>
				<tr>
					<td>DetailUrl</td>
					<td>
						<g:textField name="detailUrl" value="${dealInstance.detailUrl}"/>
					</td>
				</tr>
				<tr>
					<td>Location</td>
					<td>
						<g:textField name="location" value="${dealInstance.location}"/>
					</td>
				</tr>
				<tr>
					<td>Price</td>
					<td>
						<g:textField name="price" value="${dealInstance.price}"/>
					</td>
				</tr>
				<tr>
					<td>Merchant</td>
					<td>
						<g:select name="merchant.id" from="${com.mastercard.labs.Merchant.list()}" optionKey="id" optionValue="name" value="${dealInstance.merchant?.id}" noSelection="${['':'Select One...']}"/>
					</td>
				</tr>
				<tr>
					<td>Categories</td>
					<td>
						<g:select name="categories" multiple="true" from="${com.mastercard.labs.Category.list()}" optionKey="id" optionValue="name" value="${dealInstance.categories?.id}" noSelection="${['':'Select One...']}"/>
					</td>
				</tr>
				<tr>
					<td>Start Date</td>
					<td>
						<g:datePicker name="startDate" value="${dealInstance.startDate}" noSelection="['':'-Choose-']" precision="day" relativeYears="[0..5]"/>
					</td>
				</tr>
				<tr>
					<td>End Date</td>
					<td>
						<g:datePicker name="endDate" value="${dealInstance.endDate}" noSelection="['':'-Choose-']" precision="day" relativeYears="[0..5]"/>
					</td>
				</tr>
				<tr>
					<td>Tags</td>
					<td>
						<g:textField name="tags" value="${dealInstance.tags}"/>
					</td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td></td>
					<td>
						<g:actionSubmit action="update" value="Save" class="btn btn-primary" />
						<g:actionSubmit action="list" value="Cancel" class="btn" onclick="return confirm('Any changes made will be lost without saving. Are you sure you want to cancel?');" />
						<g:actionSubmit action="delete" value="Delete" class="btn btn-primary" />
					</td>
				</tr>
			</table>
		</g:form>
	</div>
</body>
</html>
